package com.zhongjinkang.rhythm.Model

import android.graphics.Bitmap
import android.graphics.BitmapFactory
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import java.net.URL

class HttpImageModel: BaseModel() {

    suspend fun loadBitmap(urlPath: String): Bitmap {
        return withContext(Dispatchers.IO){
            val url = URL(urlPath);
            return@withContext BitmapFactory.decodeStream(url.openStream())
        }
    }
}